<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" id="html">
    <head>
        <title></title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <base href="<?= base_url(1); ?>" />
        <link type="text/css" href="css/main.css?v=<?= $config['version'] ?>" rel="stylesheet" />
        
		<script type="text/javascript" src="<?= $config['res_url'] ?>/js/jquery.min.js?ver=<?= $config['version'] ?>"></script>
		<script type="text/javascript" src="<?= $config['res_url'] ?>/js/rgraph/libraries/RGraph.common.core.js" ></script>
		<script type="text/javascript" src="<?= $config['res_url'] ?>/js/rgraph/libraries/RGraph.line.js" ></script>
		<script type="text/javascript" src="<?= $config['res_url'] ?>/js/rgraph/libraries/RGraph.common.dynamic.js" ></script>		
		<script type="text/javascript" src="<?= $config['res_url']?>/js/rgraph/libraries/RGraph.bar.js"></script>
		<script src="js/time.js?"></script>
	
    </head>
    <body>
        <?php include(VIEWPATH . 'common/main_header.php'); ?>
        
        
        
        <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tablegrid tableedit">
    
 	 <tr>
        </center><td><!--&nbsp;
       <center>
       	 渠道名字 :<?=$channel ?>&nbsp;&nbsp;
       	平台:<?=$platform ?>&nbsp;&nbsp;
       	系统版本:<?=$osver ?>&nbsp;&nbsp;
       	联网类型:<?=$network ?>&nbsp;&nbsp;
       	设备类型:<?=$device ?>&nbsp;&nbsp;
       	游戏版本:<?=$gamever ?>&nbsp;&nbsp;
       &nbsp;&nbsp;
       	开始时间:<?= $startTime ?> &nbsp;&nbsp;
       	结束时间:<?= $endTime ?></center>--></td>          
     </tr>
     
     
     <tr>
     
     <td style="width:33%">  
      <table border='1'>
      <tr>
       	<td>VIP总量</td>
       	<td>活跃VIP总量</td>
       	<td>日期</td>
      </tr>
      <tr>
        <td><?= $infograph['allvipnum']?></td>
        <td><?= $infograph['allavipnum']?></td>
        <td><?= $infograph['targetdate']?></td>		
       </tr>
       </table>
    </td>  
     
     <td style="width:33%">  
       <table border='1'>
       <tr>
       		<?php
     		$datakeep = "";  //不初始化可能会遇到字符串中有array的情况
    		$labels = "";
      		?>
       		<td>VIP等级</td>
       <?php foreach ($datagraph['vipnum'] as $key=>$value) {?>  
       		<?php 
       				$labels .= "'".$key."'".',';?>
       				<td>&nbsp; <?=$key?></td>
       			<?php 
			}?>    		
       </tr>

       <tr>
       		<td>数量</td>
       <?php foreach ($datagraph['vipnum'] as $key=>$value) {?>
       		<?php 
       				$datakeep .= $value['num'].',';?>
       				<td>&nbsp; <?=$value['num']?></td>
       			<?php
			}?> 		
       </tr>
       
       <tr>
       		<td>VIP占比</td>
       <?php foreach ($datagraph['vipnum'] as $key=>$value) {?>
       				<td>&nbsp; <?=$value['rate']?></td>
       			<?php
			}?> 		
       </tr>
       <?php 
         	$labels = substr($labels, 0, -1);
         	$datakeep = substr($datakeep, 0, -1);
         	//$dataadd = substr($dataadd, 0, -1);
         	//$dataexpense = substr($dataexpense, 0, -1);
         	//var_dump($labels);
         	//var_dump($datakeep);
         	//exit(0);
         	?>
       </table>
    </td>  
    
    <td style="width:33%">  
       <table border='1'>
       <tr>
       		<?php
     		$datakeep1 = "";  //不初始化可能会遇到字符串中有array的情况
    		$labels1 = "";
      		?>
       		<td>活跃VIP等级</td>
       <?php foreach ($datagraph['avipnum'] as $key=>$value) {?>  
       		<?php 
       				$labels1 .= "'".$key."'".',';?>
       				<td>&nbsp; <?=$key?></td>
       			<?php 
			}?>    		
       </tr>

       <tr>
       		<td>活跃VIP数量</td>
       <?php foreach ($datagraph['avipnum'] as $key=>$value) {?>
       		<?php 
       				$datakeep1 .= $value['num'].',';?>
       				<td>&nbsp; <?=$value['num']?></td>
       			<?php
			}?> 		
       </tr>
       
       <tr>
       		<td>活跃VIP占比</td>
       <?php foreach ($datagraph['avipnum'] as $key=>$value) {?>
       				<td>&nbsp; <?=$value['rate']?></td>
       			<?php
			}?> 		
       </tr>
       <?php 
         	$labels1 = substr($labels1, 0, -1);
         	$datakeep1 = substr($datakeep1, 0, -1);
         	//$dataadd = substr($dataadd, 0, -1);
         	//$dataexpense = substr($dataexpense, 0, -1);
         	//var_dump($labels);
         	//var_dump($datakeep);
         	//exit(0);
         	?>
       </table>
    </td>  
       
     </tr>
   </table>
        
        <canvas id="cvs" width="800" height="500" style="border: 1px solid #ddd">[No canvas support]</canvas>
        <canvas id="cvs1" width="800" height="500" style="border: 1px solid #ddd">[No canvas support]</canvas>
        
        <form action="" method="POST" id="rowForm">
            <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tablegrid tableedit">
            
      <!--      <tr><td style="width:50%;text-align:right;"><?= translate('STARTTIME') ?>:</td><td style="width:50%;text-align:left;"><input type='text' name='row[starttime]' id='starttime' class='datepicker' value="<?= $startTime ?>"/></td></tr>
                <tr><td style="width:50%;text-align:right;"><?= translate('ENDTIME') ?>:</td><td style="width:50%;text-align:left;"><input type="text" name="row[endtime]" id="endtime" class='datepicker'  value="<?= $endTime ?>"/></td></tr>  -->
         <tr><td><?= translate('STARTTIME') ?>:</td><td><input type="text" name="row[starttime]" id="starttime" size= 25px value="<?= date("Y-m-d H:i:s", strtotime(date("Y-m-d"))) ?>" onclick="SelectDate(this,'yyyy-MM-dd hh:mm:ss',0,10)" showtime="true" /></td></tr>
         <tr><td><?= translate('ENDTIME') ?>:</td><td><input type="text" name="row[endtime]" id="endtime" size= 25px value="<?= date("Y-m-d H:i:s") ?>" onclick="SelectDate(this,'yyyy-MM-dd hh:mm:ss',0,10)" showtime="true" /></td></tr>
                
                <tr><td style="width:50%;text-align:right;"><?= translate('SELECT_AREA') ?>:</td><td style="width:50%;text-align:left;"><?= $arealist ?></td></tr>
               
               <!-- <tr><td style="width:50%;text-align:right;">选择分区:</td>
            		<td style="width:50%;text-align:left;"><select name="row[area]" id="area">
                      	<?php foreach ($areaList as $key => $value) {?>
            		    <option value="<?=$key ?>"><?=$value ?></option>
            		    <?php }?>
   		        </select></td></tr>  -->
   		        
                <tr><td></td><td style="width:50%;text-align:left;">
	                <input type="submit" value="<?= translate('SHENGCHENG') ?>" id="submit"/> 
                </td></tr>
            </table>
   		</form>
   		
   		
   		
   		<script>
   		
    	        
    $(document).ready(
				function()
				{
					var line = new RGraph.Bar('cvs', [<?= $datakeep?>]);
					line.Set("chart.title", "VIP数量");
					line.Set("chart.title.xaxis", "X轴/VIP等级");  //指定x轴标题
			        line.Set("chart.title.yaxis", "Y轴/总量"); //指定y轴标题
			        //line.Set('chart.key', ['存量', '产量', '消耗量']);
			        line.Set('chart.gutter.left', 100);
			        line.Set('chart.gutter.right', 50);
			        line.Set('chart.gutter.top', 50);
			        line.Set('chart.gutter.bottom', 50);
			        line.Set('chart.variant', '3d');
			        //line.Set('chart.colors', ['red', 'green', 'blue']);
			        //line.Set('chart.key', ['总存量','总产量','总消耗']);
			        //line.Set('chart.key.position', 'gutter');
		            //line.Set('chart.key.position.gutter.boxed', false);
		            //line.Set('chart.key.position.x', 1000);
		            
					line.Set("chart.labels", [<?= $labels?>]);   //不能写成<?php ?>被坑死了！
					line.Set("chart.labels.above", true);
					line.Draw();

					var line1 = new RGraph.Bar('cvs1', [<?= $datakeep1?>]);
					line1.Set("chart.title", "活跃VIP数量");
					line1.Set("chart.title.xaxis", "X轴/VIP等级");  //指定x轴标题
			        line1.Set("chart.title.yaxis", "Y轴/总量"); //指定y轴标题
			        //line1.Set('chart.key', ['存量', '产量', '消耗量']);
			        line1.Set('chart.gutter.left', 100);
			        line1.Set('chart.gutter.right', 50);
			        line1.Set('chart.gutter.top', 50);
			        line1.Set('chart.gutter.bottom', 50);
			        line1.Set('chart.variant', '3d');
			        //line1.Set('chart.colors', ['red', 'green', 'blue']);
			        //line1.Set('chart.key', ['总存量','总产量','总消耗']);
			        //line1.Set('chart.key.position', 'gutter');
		            //line1.Set('chart.key.position.gutter.boxed', false);
		            //line1.Set('chart.key.position.x', 1000);
		            
					line1.Set("chart.labels", [<?= $labels1?>]);   //不能写成<?php ?>被坑死了！
					line1.Set("chart.labels.above", true);
					line1.Draw();
				}
				
    	    )
    	        
   	
    </script>
    <script type="text/javascript">
            SG.init("core.form", function() {
                $.formValidator.initConfig({formid: "#rowForm", submitonce: true});
                $("#starttime").formValidator({empty: false, onshow: '<?= translate('PLASE_WRITE') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
                $("#endtime").formValidator({empty: false, onshow: '<?= translate('PLASE_WRITE') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
                //$("#platform").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
                //$("#game").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});  
                //$("#server").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});                  
                //$("#type").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
            });
        </script>
   		
   		
   </body>
 </html>